package com.dd.framework.security.component;

import com.alibaba.fastjson.JSONObject;
import com.dd.common.entity.CommonResult;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 用户注销处理器
 */
public class MallLogoutSuccessHandler implements LogoutSuccessHandler {
    @Override
    public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {

        response.getWriter().write(JSONObject.toJSONString(CommonResult.success("","注销成功")));
    }
}
